﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml.Serialization;
using System.Runtime.Serialization;

namespace EpidemicSimulator
{
    public class DiseaseModelNode
    {
        public DiseaseModelNode()
        {
        }

        [XmlAttribute("stateName")]
        public String stateName { get; set; }

        [XmlAttribute("stateClass")]
        public String stateClass { get; set; }

		[XmlAttribute("nodeColor")]
		public String nodeColor { get; set; }

		[XmlAttribute("nodeX")]
		public String nodeX { get; set; }

		[XmlAttribute("nodeY")]
		public String nodeY { get; set; }

        [XmlAttribute("defaultState")]
        public bool defaultState { get; set; }

        [XmlAttribute("diseaseStartState")]
        public bool diseaseStartState { get; set; }

        [XmlAttribute("infected")]
        public bool infected { get; set; }

        public static string vertexIdentity<TVertex>(TVertex v) where TVertex: DiseaseModelNode
        {
            return v.stateName;
        }
    }

    [DataContract]
    public class SilverLightDiseaseModelNode
    {
        private int m_id;

        public SilverLightDiseaseModelNode()
        {
            m_id = this.GetHashCode();
        }

        [DataMember]
        public String stateName { get; set; }

        [DataMember]
        public int Id
        {
            get { return m_id; }
            set
            {
                m_id = value;
            }
        }

        [DataMember]
        public String stateClass { get; set; }

        [DataMember]
        public String nodeColor { get; set; }

		[DataMember]
		public String nodeX { get; set; }

		[DataMember]
		public String nodeY { get; set; }
    }

    [DataContract]
    public class DiseaseModelGraph
    {
        private SilverLightDiseaseModelNode[] m_Vertices;
        private SimpleDiseaseModelEdge[] m_Edges;

        [DataMember]
        public SimpleDiseaseModelEdge[] Edges
        {
            get { return m_Edges; }
            set { m_Edges = value; }
        }

        [DataMember]
        public SilverLightDiseaseModelNode[] Vertices
        {
            get { return m_Vertices; }
            set { m_Vertices = value; }
        }
    }
}
